package com.luochen.cdpt.controller;

import com.luochen.cdpt.eneity.EmpInfo;
import com.luochen.cdpt.eneity.Page;
import com.luochen.cdpt.response.RespBean;
import com.luochen.cdpt.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
public class EmpController {
    @Autowired
    EmpService empService;

    /**
     * 通过条件查询员工列表
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/emp/list",method =RequestMethod.GET )
    public Page<Map> findEmpList(HttpServletRequest request) {
        return empService.findEmpList(request);
    }

    @ResponseBody
    @RequestMapping(value = "/emp/save",method = RequestMethod.POST )
    public RespBean save(@RequestBody EmpInfo empInfo){
        return empService.save(empInfo);
    }
}
